/* ShowDoc 离线HTML导出 - 通用样式 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Microsoft Yahei', 微软雅黑, Tahoma, Arial, Helvetica, STHeiti, sans-serif;
  font-size: 13px;
  line-height: 1.75;
  color: #343a40;
  background-color: #f9f9f9;
}

/* 头部样式 */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  background-color: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  z-index: 1000;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.header-content {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 20px;
  max-width: 100%;
}

.project-name {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  margin-right: 20px;
  color: #343a40;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 400px;
  margin-right: 20px;
}

.search-box input {
  width: 100%;
  padding: 6px 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 4px;
  font-size: 13px;
  outline: none;
  background-color: #ffffff;
  transition: border-color 0.2s;
}

.search-box input::placeholder {
  color: #9b9b9b;
}

.search-box input:focus {
  border-color: #007bff;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 400px;
  overflow-y: auto;
  display: none;
  z-index: 1001;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-results.show {
  display: block;
}

.search-result-item {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: background-color 0.15s;
}

.search-result-item:hover {
  background-color: #f9f9f9;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-title {
  font-weight: 600;
  color: #007bff;
  margin-bottom: 4px;
  font-size: 13px;
}

.search-result-preview {
  font-size: 12px;
  color: #9b9b9b;
  line-height: 1.5;
}

.search-result-item mark {
  background-color: #fff4c2;
  color: #343a40;
  padding: 2px 0;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 5px 10px;
  color: #343a40;
}

/* 容器布局 */
.container {
  display: flex;
  margin-top: 50px;
  min-height: calc(100vh - 50px);
}

/* 侧边栏 */
.sidebar {
  width: 260px;
  background-color: #f9f9f9;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  position: fixed;
  left: 0;
  top: 50px;
  bottom: 0;
  padding: 10px 0;
}

.catalog-tree {
  padding: 0 8px;
}

.catalog-item {
  margin-bottom: 2px;
}

.catalog-link {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  color: #343a40;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.15s;
  font-size: 13px;
  cursor: pointer;
}

.catalog-link:hover {
  background-color: #f0f0f0;
  color: #007bff;
}

.catalog-link.active {
  background-color: #f0f0f0;
  color: #007bff;
  border-left: 3px solid #007bff;
}

.catalog-icon {
  margin-right: 8px;
  font-size: 12px;
  width: 16px;
  min-width: 16px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  color: #9b9b9b;
}

.catalog-icon.expanded::before {
  content: '▼';
}

.catalog-icon.collapsed::before {
  content: '▶';
}

.catalog-icon.empty::before {
  content: '─';
  opacity: 0.3;
  cursor: default;
}

.catalog-children {
  margin-left: 20px;
  display: none;
}

.catalog-children.expanded {
  display: block;
}

.page-link {
  display: block;
  padding: 6px 10px;
  color: #343a40;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.15s;
  font-size: 13px;
  margin-left: 22px;
}

.page-link:hover {
  background-color: #f0f0f0;
  color: #007bff;
}

.page-link.active {
  background-color: #f0f0f0;
  color: #007bff;
  border-left: 3px solid #007bff;
}

/* 主内容区 */
.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 20px;
  max-width: 1200px;
}

.page-content {
  background: #ffffff;
  padding: 20px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  color: #343a40;
}

.project-description {
  font-size: 13px;
  color: #9b9b9b;
  margin-bottom: 20px;
  line-height: 1.75;
}

.project-overview {
  margin-top: 20px;
  padding: 16px;
  background-color: #f9f9f9;
  border-radius: 4px;
  border-left: 4px solid #007bff;
}

.project-overview p {
  margin-bottom: 10px;
  color: #343a40;
  line-height: 1.75;
}

.project-overview p:last-child {
  margin-bottom: 0;
}

/* Markdown 样式微调，接近在线版 */
.markdown-body {
  color: #343a40;
  line-height: 1.75;
  word-wrap: break-word;
  font-size: 14px;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin-top: 24px;
  margin-bottom: 1.5em;
  font-weight: 600;
  line-height: 1.75;
  color: #343a40;
}

.markdown-body h1 {
  font-size: 1.8em;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 0.3em;
}

.markdown-body h2 {
  font-size: 1.5em;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 0.3em;
}

.markdown-body h3 {
  font-size: 1.25em;
}

.markdown-body h4 {
  font-size: 1.1em;
}

.markdown-body h5 {
  font-size: 0.875em;
}

.markdown-body h6 {
  font-size: 0.85em;
  color: #9b9b9b;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote,
.markdown-body table,
.markdown-body pre {
  margin-bottom: 1.5em;
}

.markdown-body li {
  margin-bottom: 4px;
}

.markdown-body blockquote {
  padding: 0 1em;
  color: #9b9b9b;
  border-left: 4px solid rgba(0, 0, 0, 0.1);
  background-color: #f9f9f9;
  font-style: normal;
}

.markdown-body code {
  padding: 0.2em 0.4em;
  background-color: #f9f9f9;
  border-radius: 3px;
  font-size: 0.9em;
  color: #409eff;
  font-family: Consolas, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace;
}

.markdown-body pre {
  position: relative;
  padding: 1em;
  overflow: auto;
  font-size: 12px;
  line-height: 1.6;
  background-color: #384548;
  color: #d1d2d2;
  border-radius: 4px;
  margin-bottom: 1.5em;
}

.markdown-body pre code {
  display: inline;
  max-width: auto;
  padding: 0;
  margin: 0;
  overflow: visible;
  line-height: inherit;
  word-wrap: normal;
  background-color: transparent;
  border: 0;
  color: #d1d2d2;
}

/* 代码块复制按钮样式 */
.markdown-body pre .btn-pre-copy {
  display: none;
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  color: #999;
  transition: color 0.1s;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  z-index: 10;
  padding: 4px 8px;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

.markdown-body pre:hover .btn-pre-copy {
  display: block;
}

.markdown-body pre .btn-pre-copy:hover {
  color: #fff;
  background-color: rgba(0, 0, 0, 0.5);
}

/* 代码高亮注释颜色调整 */
.markdown-body .hljs-comment,
.markdown-body .hljs-quote {
  color: #aaa;
}

/* 代码块滚动条样式（适配深色背景） */
.markdown-body pre {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.5) #2f3a3d;
}

.markdown-body pre::-webkit-scrollbar {
  height: 8px;
}

.markdown-body pre::-webkit-scrollbar-track {
  background-color: #2f3a3d;
}

.markdown-body pre::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 6px;
}

.markdown-body pre::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.65);
}

/* 表格外层包装，用于自动滚动 */
.markdown-body > div[style*="overflow-x: auto"] {
  width: 100%;
  overflow-x: auto;
  margin-bottom: 1.5em;
}

.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  display: block;
  overflow-x: auto;
  margin-bottom: 1.5em;
  background-color: #f9f9f9;
}

.markdown-body table th,
.markdown-body table td {
  padding: 8px 13px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  text-align: left;
  background-color: #ffffff;
}

.markdown-body table thead tr {
  background-color: rgba(64, 158, 255, 0.1);
}

.markdown-body table th {
  font-weight: 600;
  background-color: rgba(64, 158, 255, 0.1);
  color: #343a40;
}

.markdown-body table tr:nth-child(2n) {
  background-color: #f9f9f9;
}

/* object/array[object] 行特殊样式 
   注意：由于CSS无法直接检测文本内容，此样式需要通过JavaScript动态添加类名实现
   这里先定义样式，实际应用需要在生成HTML时通过JS处理
*/
.markdown-body table tbody tr.object-row {
  background-color: #F8F8F8;
}

.markdown-body table tbody tr:hover {
  background-color: #F8F8F8;
}

.markdown-body img {
  max-width: 100%;
  height: auto;
  margin: 16px 0;
  border-radius: 4px;
}

.markdown-body a {
  color: #007bff;
  text-decoration: none;
}

.markdown-body a:hover {
  color: mix(#ffffff, #007bff, 20%);
  text-decoration: underline;
}

.markdown-body hr {
  height: 0.25em;
  padding: 0;
  margin: 24px 0;
  background-color: rgba(0, 0, 0, 0.1);
  border: 0;
}

/* 页面导航样式微调 */
.page-nav {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
}

.page-nav-link {
  display: inline-block;
  padding: 8px 14px;
  background-color: #f9f9f9;
  color: #007bff;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.15s;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.page-nav-link:hover {
  background-color: #f0f0f0;
  color: mix(#ffffff, #007bff, 20%);
}

.page-nav-link.disabled {
  color: #9b9b9b;
  cursor: not-allowed;
  opacity: 0.6;
}

.page-nav-link.disabled:hover {
  background-color: #f9f9f9;
  color: #9b9b9b;
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
  .menu-toggle {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
    z-index: 999;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 20px 15px;
  }

  .header-content {
    padding: 0 10px;
  }

  .project-name {
    font-size: 16px;
    margin-right: 10px;
  }

  .search-box {
    margin-right: 10px;
  }
}

/* 打印样式 */
@media print {
  .header,
  .sidebar,
  .menu-toggle,
  .search-box,
  .page-nav {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: 0;
  }

  .page-content {
    max-width: 100%;
  }
}
